/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * frmInicial.java
 *
 * Created on 16/02/2011, 04:00:19 PM
 */
/*
*/
package Principal;
/*
Nicolas D'Amelio C.I. 19.637.704
Daniel Santeliz C.I. 19.696.020
Nellymer Montero C.I. 20.926.114
Leandro Oliva C.I.20.187.193
 */
import Clases.*;
import java.awt.Frame;
import javax.swing.JButton;
import javax.swing.JOptionPane;

/**
 * This code was edited or generated using CloudGarden's Jigloo SWT/Swing GUI
 * Builder, which is free for non-commercial use. If Jigloo is being used
 * commercially (ie, by a corporation, company or business for any purpose
 * whatever) then you should purchase a license for each developer using Jigloo.
 * Please visit www.cloudgarden.com for details. Use of Jigloo implies
 * acceptance of these licensing terms. A COMMERCIAL LICENSE HAS NOT BEEN
 * PURCHASED FOR THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED LEGALLY FOR
 * ANY CORPORATE OR COMMERCIAL PURPOSE.
 */

public class frmInicial extends javax.swing.JFrame {

	static Seccion seccion = new Seccion();
	static Profesor profesor;
	static Estudiante estudiante;

	/** Creates new form frmInicial */
	public frmInicial() {
		initComponents();
		bAsigProfe.setVisible(false);
		bInscEstu.setVisible(false);
		btnAplicarEvaluaciones.setVisible(false);
		btnAplicarEvaluaciones.setVisible(false);
		btnPromedio.setVisible(false);
		btnListado.setVisible(false);
		labelPromedio.setVisible(false);
		txtPromedio.setVisible(false);
	}

	/**
	 * This method is called from within the constructor to initialize the form.
	 * WARNING: Do NOT modify this code. The content of this method is always
	 * regenerated by the Form Editor.
	 */
	@SuppressWarnings("unchecked")
	// <editor-fold defaultstate="collapsed"
	// <editor-fold defaultstate="collapsed"
	// desc="Generated Code">//GEN-BEGIN:initComponents
	private void initComponents() {

		bAsigSeccion = new javax.swing.JButton();
		jLabel1 = new javax.swing.JLabel();
		bAsigProfe = new javax.swing.JButton();
		bInscEstu = new javax.swing.JButton();
		btnAplicarEvaluaciones = new javax.swing.JButton();
		btnListado = new javax.swing.JButton();
		btnPromedio = new javax.swing.JButton();
		txtPromedio = new javax.swing.JTextField();
		labelPromedio = new javax.swing.JLabel();

		setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
		getContentPane().setLayout(null);

		bAsigSeccion.setText("Asignar Seccion");
		bAsigSeccion.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				bAsigSeccionActionPerformed(evt);
			}
		});
		getContentPane().add(bAsigSeccion);
		bAsigSeccion.setBounds(210, 60, 160, 49);

		jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
		jLabel1.setText("Menu de opciones");
		getContentPane().add(jLabel1);
		jLabel1.setBounds(180, 20, 220, 14);

		bAsigProfe.setText("Asignar Profesor");
		bAsigProfe.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				bAsigProfeActionPerformed(evt);
			}
		});
		getContentPane().add(bAsigProfe);
		bAsigProfe.setBounds(210, 60, 160, 50);

		bInscEstu.setText("Inscribir Estudiantes");
		bInscEstu.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				bInscEstuActionPerformed(evt);
			}
		});
		getContentPane().add(bInscEstu);
		bInscEstu.setBounds(210, 60, 160, 50);

		btnAplicarEvaluaciones.setText("Aplicar Evaluaciones");
		btnAplicarEvaluaciones
				.addActionListener(new java.awt.event.ActionListener() {
					public void actionPerformed(java.awt.event.ActionEvent evt) {
						btnAplicarEvaluacionesActionPerformed(evt);
					}
				});
		getContentPane().add(btnAplicarEvaluaciones);
		btnAplicarEvaluaciones.setBounds(210, 110, 160, 49);

		btnListado.setText("Listado Estudiantes");
		btnListado.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				btnListadoActionPerformed(evt);
			}
		});
		getContentPane().add(btnListado);
		btnListado.setBounds(210, 60, 160, 50);

		btnPromedio.setText("Promedio de notas");
		btnPromedio.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				btnPromedioActionPerformed(evt);
			}
		});
		getContentPane().add(btnPromedio);
		btnPromedio.setBounds(210, 160, 160, 50);

		txtPromedio.setEditable(false);
		txtPromedio.setHorizontalAlignment(javax.swing.JTextField.CENTER);
		getContentPane().add(txtPromedio);
		txtPromedio.setBounds(330, 230, 140, 40);

		labelPromedio.setText("EL promedio de notas es:");
		getContentPane().add(labelPromedio);
		labelPromedio.setBounds(190, 230, 150, 50);

		java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit()
				.getScreenSize();
		setBounds((screenSize.width - 616) / 2, (screenSize.height - 438) / 2,
				616, 438);
	}// </editor-fold>//GEN-END:initComponents

	private void bAsigSeccionActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_bAsigSeccionActionPerformed
		// TODO add your handling code here:
		frmAsigarSeccion as = new frmAsigarSeccion();
		as.show();
		bAsigSeccion.setVisible(false);
		bAsigProfe.setVisible(true);

	}// GEN-LAST:event_bAsigSeccionActionPerformed

	private void bAsigProfeActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_bAsigProfeActionPerformed
		// TODO add your handling code here:
		// System.out.println(seccion.getNumeroSeccion());
		frmAsigProfe ap = new frmAsigProfe();
		ap.show();
		bAsigProfe.setVisible(false);
		bInscEstu.setVisible(true);
		btnAplicarEvaluaciones.setVisible(true);

	}// GEN-LAST:event_bAsigProfeActionPerformed

	private void bInscEstuActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_bInscEstuActionPerformed
		// TODO add your handling code here:

		frmInscribir ie = new frmInscribir();
		ie.show();
		bInscEstu.setVisible(true);
		btnAplicarEvaluaciones.setVisible(true);
	}// GEN-LAST:event_bInscEstuActionPerformed

	private void btnAplicarEvaluacionesActionPerformed(
			java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btnAplicarEvaluacionesActionPerformed
		// TODO add your handling code here:
		if (seccion.getEstudiantes().size() > 0) {
			seccion.AplicarEvaluaciones();
			JOptionPane.showMessageDialog(new Frame(),
					"Las evaluaciones fueron aplicadas exitosamente");
			btnListado.setVisible(true);
			btnAplicarEvaluaciones.setVisible(false);
			btnPromedio.setVisible(true);
			bInscEstu.setVisible(false);
		}

		else {
			JOptionPane
					.showMessageDialog(new Frame(),
							"No hay estudiantes inscritos, no se puede realizar evaluaciones");
		}
	}// GEN-LAST:event_btnAplicarEvaluacionesActionPerformed

	private void btnListadoActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btnListadoActionPerformed
		// TODO add your handling code here:
		frmListados listado = new frmListados();
		listado.show();
	}// GEN-LAST:event_btnListadoActionPerformed

	private void btnPromedioActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btnPromedioActionPerformed
		// TODO add your handling code here:
		labelPromedio.setVisible(true);
		txtPromedio.setVisible(true);
		txtPromedio.setText(String.valueOf(seccion.ListaPromedio()));
	}// GEN-LAST:event_btnPromedioActionPerformed

	/**
	 * @param args
	 *            the command line arguments
	 */
	public static void main(String args[]) {
		java.awt.EventQueue.invokeLater(new Runnable() {

			public void run() {
				new frmInicial().setVisible(true);
			}
		});
	}

	// Variables declaration - do not modify//GEN-BEGIN:variables
	private javax.swing.JButton bAsigProfe;
	private javax.swing.JButton bAsigSeccion;
	private javax.swing.JButton bInscEstu;
	private javax.swing.JButton btnAplicarEvaluaciones;
	private javax.swing.JButton btnListado;
	private javax.swing.JButton btnPromedio;
	private javax.swing.JLabel jLabel1;
	private javax.swing.JLabel labelPromedio;
	private javax.swing.JTextField txtPromedio;
	// End of variables declaration//GEN-END:variables
}
